{
======================================================================
Project  : Firebird utilities
File     : uDialog.pas
Purpose  : Some often used MessageDlg replacements
Author   : Achim Kalwa <delphi@achim-kalwa.de>
Compiler : Borland Delphi 5.01
======================================================================
This unit is used for displaying often used Message dialogs.
Delphi's implementation "MessageDlg" displays the buttons in the
language of Delphi IDE, not the language of installed windows version.
This replacements calls Application.MessageBox, which in turn calls
Windows.MessageBox, showing all buttons in the correct language.

History:
2002-03-03, Kalwa:
- Unit created.
======================================================================
}
{$I fbcc.inc}
unit uDialogs;

interface

procedure InfoBox(Msg : string);
procedure ErrorBox(Msg : string);
procedure WarningBox(Msg : String);
function OkCancelBox(Msg : string) : Integer;
function YesNoBox(Msg : String) : Integer;
function YesNoCancelBox(Msg : string) : Integer;

implementation

uses
  Windows,
  Forms;

procedure InfoBox(Msg : string);
begin
  Application.MessageBox(PChar(Msg),
                         PChar(Application.Title),
                         MB_ICONINFORMATION + MB_OK);
end;

procedure ErrorBox(Msg : string);
begin
  Application.MessageBox(PChar(Msg),
                         PChar(Application.Title),
                         MB_ICONERROR + MB_OK);
end;

procedure WarningBox(Msg : String);
begin
  Application.MessageBox(PChar(Msg),
                         PChar(Application.Title),
                         MB_ICONWARNING + MB_OK);
end;

function OkCancelBox(Msg : string) : Integer;
begin
  Result := Application.MessageBox(PChar(Msg),
                                   PChar(Application.Title),
                                   MB_ICONQUESTION + MB_OKCANCEL);
end;

function YesNoBox(Msg : String) : Integer;
begin
  Result := Application.MessageBox(PChar(Msg),
                                   PChar(Application.Title),
                                   MB_ICONQUESTION + MB_YESNO);
end;

function YesNoCancelBox(Msg : string) : Integer;
begin
  Result := Application.MessageBox(PChar(Msg),
                                   PChar(Application.Title),
                                   MB_ICONQUESTION + MB_YESNOCANCEL);
end;

end.
